<?php
namespace Admin\Controller;
use Think\Controller;
class ConsultingController extends BaseController {
    public function index(){
        $consulting=M('consulting');
        $consultinglist=$consulting->select();
        $this->assign("consultinglist",$consultinglist);
    	$this->login_verify();
        $this->display();
    }
     public function addConsulting(){
        	// var_dump($_POST);
        	$class=M('consulting');
        	$data['title']=$_POST['title'];
        	$data['content']=$_POST['content'];
       		$data['time']=date('Y-m-d H:i:s');
        	if($class->add($data)){
        		$this->success('添加成功', U('Consulting/index'));
        	}else{
        		$this->error('添加失败');
        	}
        }
        // 删除操作
        public function consultingDel(){
        $id=I('get.id');
        $consulting=M('consulting');
        if($consulting->where('id='.$id)->delete()){
                $this->success("删除成功",U('Consulting/index'));
        }else{
                $this->error("删除失败");
        }
    
    }
}       